import mongoose  from 'mongoose'
import BaseModel from "./base_model"

let Schema    = mongoose.Schema;
let ObjectId  = Schema.ObjectId;

var SubmenuSchema = new Schema({
  appId:     { type: String, requried: true },
  parent_id: { type: ObjectId, requried: true },
  key:       { type: String, requried: true },
  value:     { type: String, requried: true },
  deleted:   { type: Boolean, default: false },
  enable:    { type: Boolean, default: false },
  weight:    { type: Number, default: 0 },
  create_at: { type: Date, default: Date.now }
});
SubmenuSchema.plugin(BaseModel);
SubmenuSchema.index({create_at: -1});

mongoose.model('Submenu', SubmenuSchema);
